//
//  promptAlertView.m
//  spotrs
//
//  Created by xu on 16/5/12.
//  Copyright © 2016年 TZ. All rights reserved.
//

#import "promptAlertView.h"

@implementation promptAlertView

-(id)initWithFrame:(CGRect)frame title:(NSString*)title
{
    self =[super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor clearColor]];
        [self creatView:title];
    }
    return  self;
}
-(void)creatView:(NSString*)title
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    [label setBackgroundColor:[UIColor blackColor]];
    [label setAlpha:0.3];
    [label setNumberOfLines:0];
    [label setTextAlignment:NSTextAlignmentCenter];
    label.layer.masksToBounds = YES;
    label.layer.cornerRadius = 10;
    [label setText:title];
    [label setFont:[UIFont systemFontOfSize:13]];
    [label setTextColor:[UIColor whiteColor]];
    label.center = self.center;
    [self addSubview:label];
}
-(void)showAlert
{
    [[UIApplication sharedApplication].keyWindow addSubview:self];
    [self performSelector:@selector(deleatSelf) withObject:nil afterDelay:2];
}
-(void)deleatSelf
{
    [self removeFromSuperview];
}
@end
